The ColourBlock CDEF is a CDEF for retrieving a block of colour from the user. Metrowerks C source and a 68K version is included in this archive.
The ColourBlock CDEF is freeware - you may use them, without notice, in whatever you want. The CDEF looks like this:
The 'thick' selection behaves like a traditional check-box.
Using the CDEF
CNTL resources which use this CDEF should use a proc ID of 14000. The resource ID of the ColourBlock CDEF (as supplied) is 900. The CDEF does not support any variation codes.
The colour of the CDEF is held in a data structure attached to each control, a handle to which is left in the contrlData field of the control. Your application should get/set the value in this structure, and call Draw1Control when it wants to update the on-screen value. See ColourBlock.h for the format of this structure.
The CDEF will return inCheckBox when the control is selected.
NB - the CDEF assumes that Colour QuickDraw is present, and it doesn't attempt to be sensible when it's placed on a display with a small colour depth. Your application is responsible for disabling the control if it's not feasible to use it to pick colours with. The CDEF does not attempt to dither the colour blocks.
If you’ve any comments, bug reports, or suggestions feel free to email me.
• Fixed bug which occurred when a CDEF was positioned between two displays, one of which was set to black & white, and then dragged more fully onto the colour display. Caused by passing the wrong flag to DeviceLoop. Bah.